<template>
  <router-view />
</template>

<script>
const getActiveKey = (path) => {
  switch (path) {
    case '/users/agent':
      return '1'
    case '/users/company':
      return '2'
    case '/users/user':
      return '3'
    default:
      return '1'
  }
}
export default {
  name: 'SearchLayout',
  data () {
    return {
      tabList: [
        { key: '1', tab: '代理商' },
        { key: '2', tab: '企业管理员' },
        { key: '3', tab: '普通用户' }
      ],
      tabActiveKey: '1',
      search: true
    }
  },
  created () {
    this.tabActiveKey = getActiveKey(this.$route.path)

    this.$watch('$route', (val) => {
      this.tabActiveKey = getActiveKey(val.path)
    })
  },
  methods: {
    handleTabChange (key) {
      this.tabActiveKey = key
      console.log(key)
      switch (key) {
        case '1':
          this.$router.push('/users/agent')
          break
        case '2':
          this.$router.push('/users/company')
          break
        case '3':
          this.$router.push('/users/user')
          break
        default:
          this.$router.push('/users')
      }
    }
  }
}
</script>

<style lang="less" scoped>
.ant-pro-page-header-search {
  text-align: center;
  margin-bottom: 16px;
}
</style>
